#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int n = 0;
    scanf("%d", &n);
    int board[19][19] = { 0 };
    int i = 0;
    int j = 0;
    int num = 0;
    int p1 = 0;
    int p2 = n;
    while (num < n * n)
    {
        for (j = p1; j < p2; j++)
        {
            board[p1][j] = ++num;
        }
        for (i = p1 + 1; i < p2; i++)
        {
            board[i][p2 - 1] = ++num;
        }
        for (j = p2 - 2; j >= p1; j--)
        {
            board[p2 - 1][j] = ++num;
        }
        for (i = p2 - 2; i >= p1 + 1; i--)
        {
            board[i][p1] = ++num;
        }
        p2--;
        p1++;
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            printf("%d ", board[i][j]);
        }
        printf("\n");
    }
    return 0;
}